﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLWeb_XDPM.Bussiness_Logical;
using QLWeb_XDPM.Data;

namespace QLWeb_XDPM.Presentation
{
    class QuanLi
    {/*
        #region "KetNoiCSDL........................"
        KetNoi kn = new KetNoi();
        #endregion

        #region "Quản Lí Hóa Đơn.................."
       
        //1.Lay ma Hoa Don
        public DataTable MaHD()
        {
            DataTable tb = kn.getdata("select maphieunhap from PhieuNhap", null).Tables[0];
            return tb;
        }
        //2.Lay thong tin toan bo hoa don
        public DataTable LayTTPhieuNhap(int masopn)
        {
            string truyvan = "select hd.MaHD as 'Mã HD',hd.ngaynhap as 'Ngày Nhập',ct.mamathang as 'Mã MH', ct.tennhacungcap as 'Tên Nhà Cung Cấp',ct.soluongnhap as 'Số Lượng',ct.dongianhap as 'Đơn Giá',ct.thanhtien as 'Thành Tiền' from PhieuNhap pn inner join CTPhieuNhap ct on pn.maphieunhap = ct.maphieunhap where pn.maphieunhap = " + masopn;
            DataTable tb = kn.getdata(truyvan, null).Tables[0];
            return tb;
        }
        //phuong thuc tra ve tong so tien hoa don
        public DataTable TongTien()
        {
            DataTable tb = kn.getdata("select sum(tongtien) from HoaDon", null).Tables[0];
            return tb;
        }
        // tinh tong thanh tien theoo tung phieu nhap
        public DataTable TongTienTungPhieuNhap(int masophieu)
        {
            DataTable tb = kn.getdata("select tongtien, tennhanvien from PhieuNhap where maphieunhap = " + masophieu, null).Tables[0];
            return tb;
        }
        #endregion*/
    }
}
